//
//  URL+JL.swift
//  PuDongZhanYe
//
//  Created by Li Dong on 2021/5/19.
//  Copyright © 2021 HJ. All rights reserved.
//

import UIKit


extension URL {
    init?(jlStr: String?) {
        var ss = jlStr ?? ""
        if !ss.isEmpty {
            if ss.contains(" ") {
                ss = ss.replacingOccurrences(of: " ", with: "%20")
            }
            if ss.hasChiness() {
                ss = ss.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed) ?? ""
            }
        }
        self.init(string: ss)
    }
    
    
}
